/**
     * 折线趋势图(包含最大最小平均值)
     * @param title		名称
     * @param barXData	
     * @param barYData	
     * @param elementId	元素ID
     */

    function barGraph1(title,barXData,barYData,name,unit,elementId){
    	var barXDataArr = barXData.split(',');
    	var barYDataArr = barYData.split(',');
    
    	var t = echarts.init(document.getElementById(elementId)), n = {
    		title: {
    	        text:title,
    	        x:'center'
    	    },
    	    tooltip: {
    	        trigger: 'axis'
    	    },
    	   
    	    grid: {
    	        x : 45,
    			x2 : 45,
    			y2 : 35,
    			left:'5%',
    			containLabel: true
    	    },
    	    xAxis:  {
    	        type: 'category',
    	        boundaryGap: false,
    	        data: barXDataArr
    	    },
    	    yAxis: {
    	    	name:name,
    	        type: 'value',
    	        axisLabel: {
	                formatter: '{value} '+unit
	            }
    	    },
    	    series: [
    	        {
    	            name:name,
    	            type:'line',
    	            data:barYDataArr,
    	            markPoint: {
    	                data: [
    	                    {type: 'max', name: '最大值'},
    	                    {type: 'min', name: '最小值'}
    	                ]
    	            },
    	            markLine: {
    	                data: [
    	                    {type: 'average', name: '平均值'}
    	                ]
    	            }
    	        }
    	    ]
    	};
    	t.setOption(n), window.onresize = t.resize;
}
	
	
	
	 //环比图    
	function barGraph2(title,name1,name2,barXData,barYData,barY1Data,name,unit,elementId){
		var colors = ['#5793f3', '#d14a61', '#675bba'];
		var barXDataArr = barXData.split(',');
		var barYDataArr = barYData.split(',');
		var barY1DataArr = barY1Data.split(',');
		var t = echarts.init(document.getElementById(elementId)), n = {
			title: {
    	        text:title,
    	        x:'center'
    	    },
		    color: colors,
		    tooltip: {
		        trigger: 'axis',
		        axisPointer: {
		            type: 'cross'
		        }
		    },
		    legend: {
    	        data:[name1,name2],
    	        x:'right'
    	    },
    	    grid: {
    	        x : 45,
    			x2 : 45,
    			y2 : 35,
    			left:'5%',
    			containLabel: true
    	    },
		    xAxis: [
		        {
		            type: 'category',
		            axisTick: {
		                alignWithLabel: true
		            },
		            data: barXDataArr
		        }
		    ],
		    yAxis: [
		        {
		            type: 'value',
		            name:name,
		            position: 'left',
		            axisLine: {
		                lineStyle: {
		                    color: colors[0]
		                }
		            },
		            axisLabel: {
		                formatter: '{value} '+unit
		            }
		        },
		       
		        {
		            type: 'value',
		            position: 'right',
		            axisLine: {
		                lineStyle: {
		                    color: colors[2]
		                }
		            },
		            axisLabel: {
		                formatter: '{value} %'
		            }
		        }
		    ],
		    series: [
		        {
		        	name:name1,
		            type:'bar',
		            data:barYDataArr
		        },
		        {
		        	name:name2,
		            type:'line',
		            yAxisIndex: 1,
		            data:barY1DataArr
		        }
		    ]
		};
		t.setOption(n), window.onresize = t.resize;
	}
	
	
	//同比图
	function barGraph3(title,name,name1,name2,name3,barXData,barYData,barY1Data,barY2Data,unit,elementId){
		var barXDataArr = barXData.split(',');
		var barYDataArr = barYData.split(',');
		var barY1DataArr = barY1Data.split(',');
		var barY2DataArr = barY2Data.split(',');
		var colors = ['#5793f3', '#d14a61', '#675bba'];
		var t = echarts.init(document.getElementById(elementId)), n = {
			title: {
    	        text:title,
    	        x:'center'
    	    },
    	    legend: {
    	        data:[name1,name2,name3],
    	        x:'right'
    	    },
    	    grid: {
    	        x : 45,
    			x2 : 45,
    			y2 : 35,
    			left:'5%',
    			containLabel: true
    	    },
		    color: colors,
		    tooltip: {
		        trigger: 'axis',
		        axisPointer: {
		            type: 'cross'
		        }
		    },
		    
		    xAxis: [
		        {
		            type: 'category',
		            axisTick: {
		                alignWithLabel: true
		            },
		            data:barXDataArr
		        }
		    ],
		    yAxis: [
		        {
		            type: 'value',
		            name:name,
		            position: 'left',
		            axisLine: {
		                lineStyle: {
		                    color: colors[0]
		                }
		            },
		            axisLabel: {
		                formatter: '{value} '+unit
		            }
		        },
		        {
		            type: 'value',
		            position: 'right',
		            axisLine: {
		                lineStyle: {
		                    color: colors[2]
		                }
		            },
		            axisLabel: {
		                formatter: '{value} %'
		            }
		        }
		    ],
		    series: [
		        {
		            name:name1,
		            type:'bar',
		            data:barYDataArr
		        },
		        {
		            name:name2,
		            type:'bar',
		            yAxisIndex: 0,
		            data:barY1DataArr
		        },
		        {
		            name:name3,
		            type:'line',
		            yAxisIndex: 1,
		            data:barY2DataArr
		        }
		    ]
		};
		t.setOption(n), window.onresize = t.resize;
	}

	
//单柱状图
	function barGraph5(title,name,barXData,barYData,unit,elementId){
		var barXDataArr = barXData.split(',');
		var barYDataArr = barYData.split(',');
		var colors = ['#5793f3', '#d14a61', '#675bba'];
		var t = echarts.init(document.getElementById(elementId)), n ={
				title: {
			        text: title,
			        x:'center'
			    },
			     tooltip: {
			        trigger: 'axis',
			        axisPointer: {
			            type: 'cross'
			        }
			    },
			    xAxis: {
			        axisLabel: {  
			            interval:0,  
			            rotate:20 
			         },
			    data: barXDataArr   
			    },
			    yAxis: {
			        name:name,
			        type: 'value',
			        axisLabel: {
		                formatter: '{value} '+unit
		            }
			    },
			    series: [{
			        data: barYDataArr,
			        type: 'bar'
			    }]
			};
		t.setOption(n), window.onresize = t.resize;
	}

	
	//漏斗图
	
function barGraph6(title,name,sort,barYData,elementId){
	
	 
	var t = echarts.init(document.getElementById(elementId)), n ={
		    title: {
		        text: title ,
		        x:'center'
		    },

		    tooltip: {
		        trigger: 'item',
		        formatter: "{a} <br/>{b} : {c}"
		    },
		    calculable: true,
		    series: [
		        {
		            name: name ,
		            type:'funnel',
		            left: '10%',
		            top: 60,
		            bottom: 60,
		            width: '80%',
		            sort: sort,
		            gap: 2,
		            label: {
		                show: true,
		                position: 'inside'
		            },
		            labelLine: {
		                length: 10,
		                lineStyle: {
		                    width: 1,
		                    type: 'solid'
		                }
		            },
		            itemStyle: {
		                borderColor: '#fff',
		                borderWidth: 1
		                
		            },
		            emphasis: {
		                label: {
		                    fontSize: 20
		                }
		            },
		          
		            data: 
		            	barYData
		        }
		    ]
		};
	t.setOption(n), window.onresize = t.resize;
	}


